<?php
/**
 * Created by PhpStorm.
 * User: D
 * Date: 2019/5/11
 * Time: 10:27
 */

header("Access-Control-Allow-Origin:*");
header("Content-Type:application/json;charset=utf-8");
session_start();
include "dbHelper.php";
if($_SERVER["REQUEST_METHOD"]=="POST"){
    if((isset($_REQUEST["uname"])&&isset($_REQUEST["upwd"]))){
        $UNAME=$_POST["uname"];
        $UPWD=$_POST["upwd"];
        $sql="SELECT `u_id`,`u_name`,`u_tel`,`u_email` FROM `userinfo1` WHERE u_name='".$UNAME."'AND u_pwd='".$UPWD."'";
       // print_r($sql);
        $result=dbHelper($sql);
       // print_r($result);
        if($result->num_rows>=1){
            $userinfoArr=$result->fetch_assoc();
            print_r(json_encode(Array("msg"=>"登录成功","status"=>1,"data"=>$userinfoArr)));

            $_SESSION["userinfo1"]=$userinfoArr;
        }else{

            print_r(json_encode(Array("msg"=>"登录失败","status"=>0)));
        }
    }
}else{
    print_r(json_encode(Array("msg"=>"不支持get请求","status"=>-1)));
}
